package com.naiterui.ehp.bs.agent.controller;

import com.naiterui.common.repository.page.PageParamVO;
import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.bo.statistics.DataReportBO;
import com.naiterui.ehp.bp.bo.statistics.DataReportInviteBO;
import com.naiterui.ehp.bp.bo.statistics.DataReportProductBO;
import com.naiterui.ehp.bp.bo.statistics.DataReportRecipelBO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bs.agent.service.IDataReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 经纪人数据报表
 * 
 * @author yangfuya
 * @since 2022/2/15
 */
@Slf4j
@Api(tags = {SwaggerTag.AGENT + "数据报表"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/data/report")
public class DataReportController {
    private final IDataReportService dataReportService;

    @ApiOperation("数据报表首页")
    @GetMapping("index")
    @ApiImplicitParam(name = "agentId", value = "经纪人Id", dataType = "long", paramType = "query", required = true)
    private DataReportBO index(@RequestParam Long agentId) {
        return dataReportService.index(agentId);
    }

    @ApiOperation("数据报表处方相关")
    @GetMapping("getRecipel")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "agentId", value = "经纪人Id", dataType = "long", paramType = "query", required = true),
        @ApiImplicitParam(name = "reportType", value = "报告类型：1.年 2.月 3.日", dataType = "int", paramType = "query",
            required = true),
        @ApiImplicitParam(name = "reportDate", value = "年月 yyyy-MM格式", dataType = "string", paramType = "query")})
    private DataReportRecipelBO getRecipel(@RequestParam Long agentId, Integer reportType, String reportDate) {
        return dataReportService.getRecipel(agentId, reportType, reportDate);
    }

    @ApiOperation("数据报表商品售卖")
    @GetMapping("getProduct")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "agentId", value = "经纪人Id", dataType = "long", paramType = "query", required = true),
        @ApiImplicitParam(name = "reportType", value = "报告类型：1.年 2.月 3.日", dataType = "int", paramType = "query",
            required = true),
        @ApiImplicitParam(name = "reportDate", value = "年月 yyyy-MM格式", dataType = "string", paramType = "query")})
    private PageVO<DataReportProductBO> getProduct(PageParamVO paramVO, Long agentId, Integer reportType,
        String reportDate) {
        return dataReportService.getProduct(paramVO, agentId, reportType, reportDate);
    }

    @ApiOperation("数据报表邀请医生")
    @GetMapping("getInvite")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "agentId", value = "经纪人Id", dataType = "long", paramType = "query", required = true),
        @ApiImplicitParam(name = "reportType", value = "报告类型：1.年 2.月 3.日", dataType = "int", paramType = "query",
            required = true),
        @ApiImplicitParam(name = "reportDate", value = "年月 yyyy-MM格式", dataType = "string", paramType = "query")})
    private DataReportInviteBO getInvite(Long agentId, Integer reportType, String reportDate) {
        return dataReportService.getInvite(agentId, reportType, reportDate);
    }
}
